package cz.muni.fi.PA165.musiclibraryweb.signin;

import org.apache.wicket.authroles.authorization.strategies.role.Roles;

/**
 *
 * @author kubi
 */
public class User {
    private String name;
    private Roles roles;

    
    public User (String name, String roles){
        if (name == null)
        {
            throw new IllegalArgumentException("name must be not null");
        }
        if (roles == null)
        {
            throw new IllegalArgumentException("roles must be not null");
        }
        this.name = name;
        this.roles = new Roles(roles);
        
    }
    
    public boolean hasRole(String role)
    {
        return roles.hasRole(role);
    }
    
    public boolean hasAnyRole(Roles roles)
    {
        return this.roles.hasAnyRole(roles);
    }
    
    public String getName()
    {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setRoles(Roles roles) {
        this.roles = roles;
    }
    
    @Override
    public String toString()
    {
        return name + " " + roles;
    }
        
}
